package com.batsoft.trade;

import com.batsoft.trade.core.BuilderFastTrade;
import com.batsoft.trade.core.MatchOrder;
import com.batsoft.trade.model.transaction.ContractTrade;
import com.batsoft.trade.model.transaction.ContractType;
import com.batsoft.trade.model.transaction.CycleDate;
import com.batsoft.trade.model.transaction.Source;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Random;

public class BatsoftFastTradeApplication {

    public static void main(String[] args) {
        MatchOrder matchOrder = BuilderFastTrade.build();

        for (int i = 0; i < 1000000000; i++) {
            ContractTrade trade = new ContractTrade();
            trade.setCycle(CycleDate.CURRENT);
            trade.setEntrustTime(new Date());
            trade.setFeeRatio(new BigDecimal(0.05));
            trade.setFaceValue(new BigDecimal(10));
            trade.setLend(20);
            trade.setHandleType(ContractType.SELL_FLAT_MORE);
            trade.setKeepDecimalForCoin(6);
            trade.setKeepDecimalForCurrency(0);
            trade.setUid(233L);
            trade.setCoinCode("BTC_USD");
            trade.setCount(new BigDecimal(20));
            trade.setPrice(new BigDecimal(30));
            trade.setMarket(false);
            trade.setSource(Source.IOS);
            trade.setOrderNum(new Date().getTime() + new Random().nextInt(1000000000) + i + "");
            matchOrder.match(trade);
        }
    }

}
